package com.junxonline.plat.dao.repository;

import com.junxonline.plat.dao.model.House;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface HouseRepository extends JpaRepository<House, Long>, JpaSpecificationExecutor<House> {

    House findByHouseId(Long houseId);

    List<House> findByHouseIdIn(Long[] houseIds);

    @Query(value = "SELECT house.* FROM plat_house house ORDER BY house.update_after_no DESC LIMIT 1", nativeQuery = true)
    House findByHouseIdLast();

}
